package com.itheima.day13.第一题;


import com.sun.xml.internal.ws.util.StringUtils;

import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class demo {
    public static void main(String[] args) {
        /*String s1 = "4+2-1".replaceAll("\\d+","");
        System.out.println(s1);*/


        计算( "55-5");
        计算("12-23");
        计算("5/5");
        计算("5*5");
    }

    private static void 计算(String str) {
        String num = str;
        String s1 = str.replaceAll("\\d+","");
        if (s1.equals("*")) {
            s1 = "\\*";
        }
        //System.out.println(num.split(s1)[0]);
        int num1 = Integer.parseInt(num.split(s1)[0]);
        //System.out.println(num.split(s1)[1]);
        int num2 = Integer.parseInt(num.split(s1)[1]);
        switch (s1){
            case "+":
                System.out.println(num1 + "+" + num2 + "=" + (num1 + num2));
                break;
            case "-":
                System.out.println(num1 + "-" + num2 + "=" + (num1 - num2));
                break;
            case "\\*":
                System.out.println(num1 + "*" + num2 + "=" + (num1 * num2));
                break;
            case "/":
                System.out.println(num1 + "/" + num2 + "=" + (num1 / num2));
                break;
        }

    }


}
